#ifndef	_TSPARCV9_H_
#define	_TSPARCV9_H_

#pragma ident	"@(#)tsparcv9.h	1.17	06/05/05 SMI"

#ifdef	__cplusplus
extern "C" {
#endif

	/* Target SPARC v9 definitions */
	/* interface functions and data structs */

typedef enum {
	/* MANDATORY SPARC V9 ASIs */

	V9_ASI_NUCLEUS					= 0x4 , /* RW Implicit Address Space, nucleus context, TL>0 */
	V9_ASI_NUCLEUS_LITTLE				= 0xc , /* RW Implicit Address Space, nucleus context, TL>0 (LE) */
	V9_ASI_AS_IF_USER_PRIMARY			= 0x10, /*  RW Primary Address Space, user privilege */
	V9_ASI_AS_IF_USER_SECONDARY			= 0x11, /*  RW Secondary Address Space, user privilege */
	V9_ASI_AS_IF_USER_PRIMARY_LITTLE		= 0x18, /*  RW Primary Address Space, user privilege (LE) */
	V9_ASI_AS_IF_USER_SECONDARY_LITTLE		= 0x19, /*  RW Secondary Address Space, user privilege (LE) */
	V9_ASI_PRIMARY					= 0x80, /*  RW Implicit Primary Address space */
	V9_ASI_SECONDARY				= 0x81, /*  RW Implicit Secondary Address space */
	V9_ASI_PRIMARY_NO_FAULT				= 0x82, /*  R Primary Address space, no fault */
	V9_ASI_SECONDARY_NO_FAULT			= 0x83, /*  R Secondary Address space, no fault */
	V9_ASI_PRIMARY_LITTLE				= 0x88, /*  RW Implicit Primary Address space (LE) */
	V9_ASI_SECONDARY_LITTLE				= 0x89, /*  RW Implicit Secondary Address space (LE) */
	V9_ASI_PRIMARY_NO_FAULT_LITTLE			= 0x8A, /*  R Primary Address space, no fault (LE) */
	V9_ASI_SECONDARY_NO_FAULT_LITTLE		= 0x8B /*  R Secondary Address space, no fault (LE) */

} v9_asi_t;

#define	V9_ASI_IMPLICIT		(-1)

typedef struct SPARCV9_CPU	sparcv9_cpu_t;

extern	sparcv9_cpu_t * sparcv9_cpu_alloc(
		domain_t * domainp,
		config_proc_t * config_procp,
		int nwins,
		int nglobals,
		int maxtl,
		uint64_t ver,
		bool_t has_fpu,
		proc_debug_t *proc_debugp,
		void * magicptr);

bool_t	sparcv9_regread(sparcv9_cpu_t * v9p, int regnum, uint64_t * valp);
bool_t	sparcv9_regwrite(sparcv9_cpu_t * v9p, int regnum, uint64_t val);
void	sparcv9_set_break(sparcv9_cpu_t * v9p, tvaddr_t addr);
void	sparcv9_set_break_next(sparcv9_cpu_t * v9p);
void	sparcv9_clear_break_next(sparcv9_cpu_t * v9p);
bool_t	sparcv9_hit_break(sparcv9_cpu_t * v9p, tvaddr_t addr);
void	sparcv9_clear_break(sparcv9_cpu_t * v9p, tvaddr_t addr);

void sparcv9_active_window(simcpu_t * sp, int new_window);
void sparcv9_active_globals(simcpu_t * sp, int new_global);

void sparcv9_perf_dump(void * v9p);

void sparcv9_decode_me(simcpu_t * sp, xicache_instn_t * xcip);

extern reg_map_t sparcv9_reg_map[];

extern void sparcv9_idis(char * bufp, int size, uint32_t instn, tvaddr_t address);
extern void sparcv9_trace_output(simcpu_t * sp, uint32_t instn);

#ifdef	__cplusplus
}
#endif

#endif	/* _TSPARCV9_H_ */
